Line and step line series
A LineSeries joins its points with a line, straight or curved, and can fill the area below it. A StepLineSeries
joins them with horizontal and vertical segments instead. Both series share almost every property, so this article covers
them together: everything below applies to both, except LineSmoothness, which only the line series has.
This article highlights the most used features. Every property is listed in the API explorer: LineSeries and StepLineSeries.
Basic line
Set the Values of the series and add it to the chart. Every point is drawn with a geometry, a circle by default.
The second generic argument changes the geometry, the second series in this sample uses a StarGeometry.

using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using LiveChartsCore.SkiaSharpView.VisualElements;
namespace WinFormsSample.Lines.Basic;
public partial class View : UserControl
{
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);
var values1 = new double[] { 2, 1, 3, 5, 3, 4, 6 };
var values2 = new int[] { 4, 2, 5, 2, 4, 5, 3 };
var series = new ISeries[]
{
new LineSeries<double>
{
Values = values1,
Fill = null,
GeometrySize = 20
},
new LineSeries<int, StarGeometry>
{
Values = values2,
Fill = null,
GeometrySize = 20
}
};
var title = new DrawnLabelVisual(
new LabelGeometry
{
Text = "My chart title",
TextSize = 25,
Padding = new LiveChartsCore.Drawing.Padding(15)
});
var cartesianChart = new CartesianChart
{
Series = series,
Title = title,
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(50, 50),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}
Straight or smooth lines
LineSmoothness goes from 0 to 1: 0 draws straight segments between the points and 1 draws the most curved
line. Values outside that range are clamped to it. Setting GeometrySize to 0 hides the points.

using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
namespace WinFormsSample.Lines.Straight;
public partial class View : UserControl
{
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);
var values1 = new double[] { 5, 0, 5, 0, 5, 0 };
var values2 = new double[] { 7, 2, 7, 2, 7, 2 };
var series = new ISeries[]
{
new LineSeries<double>
{
Values = values1,
Fill = null,
GeometrySize = 0,
LineSmoothness = 0
},
new LineSeries<double>
{
Values = values2,
Fill = null,
GeometrySize = 0,
LineSmoothness = 1
}
};
var cartesianChart = new CartesianChart
{
Series = series,
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(50, 50),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}
Area
The Fill paint fills the area under the line. Set Fill to null to draw only the line, or set Stroke and the
geometry paints to null to draw only the area.

using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
namespace WinFormsSample.Lines.Area;
public partial class View : UserControl
{
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);
var values = new double[] { -2, -1, 3, 5, 3, 4, 6 };
var series = new ISeries[]
{
new LineSeries<double>
{
Values = values,
Fill = new SolidColorPaint(SKColor.Parse("#6495ED")),
Stroke = null,
GeometryFill = null,
GeometryStroke = null
}
};
var drawMarginFrame = new DrawMarginFrame
{
Stroke = new SolidColorPaint(SKColor.Parse("#64b4b4b4")),
Fill = new SolidColorPaint(SKColor.Parse("#32dcdcdc"))
};
var cartesianChart = new CartesianChart
{
Series = series,
DrawMarginFrame = drawMarginFrame,
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(50, 50),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}
Stroke and fill paints
When Stroke, Fill, GeometryStroke or GeometryFill are not set, LiveCharts picks them from the current theme,
based on the position of the series in the chart's series collection. Set them to use your own colors.
Stroke draws the line:

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Stroke = new SolidColorPaint(SKColors.Blue) { StrokeThickness = 4 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Stroke = new SolidColorPaint(SKColors.Red) { StrokeThickness = 8 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 4, 2, 5, 3, 9 },
Stroke = new SolidColorPaint(SKColors.Green) { StrokeThickness = 1 }, // mark
Fill = null,
GeometryFill = null,
GeometryStroke = null
}
};
Fill draws the area. The alpha channel goes from 0 (transparent) to 255 (opaque):

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Fill = new SolidColorPaint(SKColors.Blue.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Fill = new SolidColorPaint(SKColors.Red.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
},
new LineSeries<int>
{
Values = new [] { 4, 2, 5, 3, 9 },
Fill = new SolidColorPaint(SKColors.Green.WithAlpha(90)), // mark
Stroke = null,
GeometryFill = null,
GeometryStroke = null
}
};
Paints can also draw gradients and dashed lines, see the Paints article.
Point geometries
GeometryFill and GeometryStroke paint the shape drawn at each point, and GeometrySize sets its size. While
GeometryStroke is not set, the theme derives it from the series' Stroke (when Stroke is a SolidColorPaint),
so the points match the line.

Series = new ISeries[]
{
new LineSeries<int>
{
Values = new [] { 4, 4, 7, 2, 8 },
Stroke = new SolidColorPaint(SKColors.Blue) { StrokeThickness = 4 },
Fill = null,
GeometryFill = new SolidColorPaint(SKColors.AliceBlue), // mark
GeometryStroke = new SolidColorPaint(SKColors.Gray) { StrokeThickness = 4 } // mark
},
new LineSeries<int>
{
Values = new [] { 7, 5, 3, 2, 6 },
Stroke = new SolidColorPaint(SKColors.Red) { StrokeThickness = 8 },
Fill = null,
GeometryFill = new SolidColorPaint(SKColors.IndianRed), // mark
GeometryStroke = new SolidColorPaint(SKColors.DarkSalmon) { StrokeThickness = 8 } // mark
}
};
The shape itself can be any geometry. The next sample uses, in order, the default circle, a predefined
StarGeometry (the LiveChartsCore.SkiaSharpView.Drawing.Geometries namespace has more, such as CrossGeometry,
DiamondGeometry and RectangleGeometry), an SVG path through VariableSVGPathGeometry and GeometrySvg, and a
geometry drawn with the SkiaSharp API (MyGeometry).

using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using ViewModelsSamples.Lines.Custom;
using LiveChartsCore.Drawing;
namespace WinFormsSample.Lines.Custom;
public partial class View : UserControl
{
public View()
{
Size = new System.Drawing.Size(50, 50);
var values1 = new double[] { 2, 1, 4, 2, 2, -5, -2 };
var values2 = new double[] { 3, 3, -3, -2, -4, -3, -1 };
var values3 = new double[] { -2, 2, 1, 3, -1, 4, 3 };
var values4 = new double[] { 4, 5, 2, 4, 3, 2, 1 };
var pinPath = SVGPoints.Pin;
var series = new ISeries[]
{
new LineSeries<double>
{
Values = values1,
Fill = null,
GeometrySize = 20
},
// the second type argument is the geometry type
// there are many built-in geometries available at the
// LiveChartsCore.SkiaSharpView.Drawing.Geometries namespace.
new LineSeries<double, StarGeometry>
{
Values = values2,
Fill = null,
GeometrySize = 20
},
// the variable SVG path geometry allows you to
// change the SVG path at runtime, this has a performance penalty.
new LineSeries<double, VariableSVGPathGeometry>
{
Values = values3,
Fill = null,
GeometrySize = 20,
GeometrySvg = pinPath
},
// finally, you can create your own custom geometry
// using skiasharp.
new LineSeries<double, MyGeometry>
{
Values = values4,
Fill = null,
GeometrySize = 20
}
};
var cartesianChart = new CartesianChart
{
Series = series,
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(50, 50),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}
using LiveChartsCore.Drawing;
using LiveChartsCore.SkiaSharpView.Drawing;
namespace ViewModelsSamples.Lines.Custom;
public class MyGeometry : BoundedDrawnGeometry, IDrawnElement<SkiaSharpDrawingContext>
{
public void Draw(SkiaSharpDrawingContext context)
{
var paint = context.ActiveSkiaPaint;
var canvas = context.Canvas;
canvas.DrawRect(X, Y, Width, Height, paint);
canvas.DrawLine(X, Y, X + Width, Y + Height, paint);
canvas.DrawLine(X + Width, Y, X, Y + Height, paint);
}
}
Customize each point
The PointMeasured event (a command in the XAML samples) runs every time a point gets its size and position, and
gives access to both the data and the drawn shape. This sample stores a wind direction in each data point and rotates
an arrow geometry to match it.

using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
using SkiaSharp;
namespace WinFormsSample.Lines.CustomPoints;
public class DataPoint
{
public int Value { get; set; }
public float Rotation { get; set; }
}
public class ArrowGeometry : BaseSVGPathGeometry
{
private static SKPath _path = SKPath.ParseSvgPathData(
"M1 16 A15 15 0 1 0 31 16 A15 15 0 1 0 1 16 Z " + // the circle
"M16 25 L16 7 M9.5 13.5 L16 7 L22.5 13.5"); // the arrow, pointing up
public ArrowGeometry() : base(_path) { }
}
public class CustomArrowLineSeries : LineSeries<DataPoint, ArrowGeometry>
{
public CustomArrowLineSeries()
{
LiveCharts.Configure(config =>
config.HasMap<DataPoint>((dataPoint, index) => new(index, dataPoint.Value)));
Fill = null;
GeometrySize = 34;
PointMeasured += (point) =>
{
var dataPoint = (DataPoint)point.Context.DataSource;
point.Context.Visual.RotateTransform = dataPoint.Rotation;
};
}
}
public partial class View : UserControl
{
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);
var values = new DataPoint[]
{
new() { Value = 4, Rotation = 0 },
new() { Value = 6, Rotation = 20 },
new() { Value = 8, Rotation = 90 },
new() { Value = 2, Rotation = 176 },
new() { Value = 7, Rotation = 55 },
new() { Value = 9, Rotation = 226 },
new() { Value = 3, Rotation = 320 }
};
var series = new ISeries[]
{
new CustomArrowLineSeries
{
Values = values
}
};
var cartesianChart = new CartesianChart
{
Series = series,
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(50, 50),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}
Gaps
A null value creates a gap in the line, both a null number (double?, int?) and a null item in the
collection, such as a null ObservablePoint. This is controlled by EnableNullSplitting, which is true by
default; disabling it saves some work when your data never contains nulls.

using System.Windows.Forms;
using LiveChartsCore;
using LiveChartsCore.Defaults;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.WinForms;
namespace WinFormsSample.General.NullPoints;
public partial class View : UserControl
{
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(600, 400);
var values1 = new double?[] { 5, 4, null, 3, 2, 6, 5, 6, 2 };
var values2 = new double?[] { 2, 6, 5, 3, null, 5, 2, 4, null };
var values3 = new ObservablePoint[]
{
new() { X = 0, Y = 1 },
new() { X = 1, Y = 4 },
null,
new() { X = 4, Y = 5 },
new() { X = 6, Y = 1 },
new() { X = 8, Y = 6 },
};
var series = new ISeries[]
{
new LineSeries<double?> { Values = values1 },
new LineSeries<double?> { Values = values2 },
new LineSeries<ObservablePoint> { Values = values3 }
};
var cartesianChart = new CartesianChart
{
Series = series,
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(600, 400),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}
Step lines
A StepLineSeries takes the same properties as the line series, except LineSmoothness. All the paints, geometries,
gaps and data labels in this article work the same way on it.

using System.Windows.Forms;
using LiveChartsCore.SkiaSharpView.WinForms;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using LiveChartsCore.SkiaSharpView.VisualElements;
using LiveChartsCore.SkiaSharpView.Drawing.Geometries;
namespace WinFormsSample.StepLines.Basic;
public partial class View : UserControl
{
public View()
{
InitializeComponent();
Size = new System.Drawing.Size(50, 50);
var values = new double[] { 2, 1, 3, 4, 3, 4, 6 };
var series = new ISeries[]
{
new StepLineSeries<double>
{
Values = values,
Fill = null,
GeometrySize = 20
}
};
var title = new DrawnLabelVisual(
new LabelGeometry
{
Text = "My chart title",
TextSize = 25,
Padding = new LiveChartsCore.Drawing.Padding(15)
});
var cartesianChart = new CartesianChart
{
Series = series,
Title = title,
Location = new System.Drawing.Point(0, 0),
Size = new System.Drawing.Size(50, 50),
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom
};
Controls.Add(cartesianChart);
}
}
Data labels
Data labels draw a label next to every point:

new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
Fill = null,
DataLabelsSize = 20,
DataLabelsPaint = new SolidColorPaint(SKColors.Blue),
// all the positions:
// https://livecharts.dev/api/2.2.0/LiveChartsCore.Measure.DataLabelsPosition
DataLabelsPosition = LiveChartsCore.Measure.DataLabelsPosition.Top,
// the formatter takes the point and returns the label text
DataLabelsFormatter = point => point.Coordinate.PrimaryValue.ToString("C2")
}
Data padding
DataPadding is the space between the first and last points and the edges of the chart, measured in axis ticks
(the distance between two separators). It is a LvcPoint, X for the horizontal edges and Y for the vertical ones.

new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
DataPadding = new LvcPoint(0, 0), // mark
GeometryStroke = null,
GeometryFill = null,
Fill = null
}
Data, names and updates
Valuestakes anyIEnumerable<T>. Use anObservableCollection<T>and the chart animates every added, removed or replaced value, see automatic updates.- To plot your own types, or set both X and Y, see mappers.
Nameis shown in tooltips and legends. When it is not set, the tooltip shows the values without a series name.ZIndexsets which series draws on top, andIsVisibleshows or hides the series.